<template>
    <view class="my">
        <view>会员信息：{{ memberStore.profile }}</view>
        <button 
            @tap="memberStore.setProfile({ nickname: '黑马先锋'})"
            size="mini" 
            plain 
            type="primary">
            保存用户信息
        </button>

        <button 
            @tap="memberStore.clearProfile()" 
            size="mini" 
            plain 
            type="warn">
            清理用户信息
        </button>
		<button @tap="getData" >
			测试请求封装
		</button>
				
    </view>
</template>
<script setup>
	import { http } from '@/utils/request';
	import { useMemberStore } from '@/stores/modules/test.js';
	// 注意:要手动引入拦截器
	import '@/utils/interceptor'
	
    const memberStore = useMemberStore();
	const onChooseAvatar = (e) => {
	    console.log(e)
	  };
	
	// unirequest可以换成自己封装的http就行了
	const getData = async () => {
	    const res = await http({
	        method: 'GET',
	        url: '/abc/',
	        headers: {abc:"123"}
	    });
	    // console.log(res.data);
	    return res;
	};
</script>

